namespace WebRtcProject.Models.Configuration
{
    /// <summary>
    /// RabbitMQ 外部服务连接配置
    /// 用于连接现有的 RabbitMQ 服务器，专注于队列订阅和发送功能
    /// </summary>
    public class RabbitMQOptions
    {
        public const string SectionName = "RabbitMQ";
        public const string ExchangeName = "rtc.topic";

        // 基础连接配置
        public string HostName { get; set; } = "localhost";
        public int Port { get; set; } = 5672;
        public string UserName { get; set; } = "guest";
        public string Password { get; set; } = "guest";
        public string VirtualHost { get; set; } = "/";
        public bool Enabled { get; set; } = true;
        public bool UseTLS { get; set; } = false;

        // 连接池配置
        public int MaxChannelPoolSize { get; set; } = 10;
        public TimeSpan ConnectionTimeout { get; set; } = TimeSpan.FromSeconds(30);
        public TimeSpan HeartbeatInterval { get; set; } = TimeSpan.FromMinutes(1);

        // 目标队列配置
        public TargetQueueOptions TargetQueues { get; set; } = new();
        
        // 订阅配置
        public SubscriptionOptions Subscription { get; set; } = new();
        
        // 发布配置
        public PublishingOptions Publishing { get; set; } = new();
    }

    /// <summary>
    /// 目标队列配置 - 指定要操作的队列名称
    /// </summary>
    public class TargetQueueOptions
    {
        public string IncomingQueue { get; set; } = "incoming.queue";
        public string OutgoingQueue { get; set; } = "outgoing.queue";
        public string NotificationQueue { get; set; } = "notification.queue";
    }

    /// <summary>
    /// 消息订阅配置
    /// </summary>
    public class SubscriptionOptions
    {
        public bool AutoAck { get; set; } = false;          // 手动确认消息
        public ushort PrefetchCount { get; set; } = 10;     // 预取消息数量
        public bool RequeueOnFailure { get; set; } = true;  // 失败时重新入队
        public int MaxRetryAttempts { get; set; } = 3;      // 最大重试次数
    }

    /// <summary>
    /// 消息发布配置
    /// </summary>
    public class PublishingOptions
    {
        public bool Persistent { get; set; } = true;        // 消息持久化
        public bool Mandatory { get; set; } = true;         // 强制路由
        public bool Immediate { get; set; } = false;        // 立即消费要求
        public bool ConfirmMode { get; set; } = true;       // 发送确认模式
    }
} 